package com.daniu.demo.jdk.collection;

import java.util.*;

public class SetDemo {

    public static void main(String[] args) {
        Set<String> set = new HashSet<String>();
        set.add("de");
        set.add("ae");
        set.add("2e");
        set.add("2e");

        set.forEach((s)->System.out.println(s));

        System.out.println("...................HashSet end..................");


        Set<String> linkedHashSet = new LinkedHashSet<>();
        linkedHashSet.add("a");
        linkedHashSet.add("c");
        linkedHashSet.add("b");


        linkedHashSet.forEach(System.out::println);

        System.out.println("...................linkedHashSet end..................");


        Set<String> treeSet = new TreeSet<>();
        treeSet.add("a");
        treeSet.add("c");
        treeSet.add("b");


        treeSet.forEach(System.out::println);
    }
}
